import java.util.Scanner;

/**
 * Created with IntelliJ IDEA
 * Description:
 * User: Administrator
 * Data: 2023 - 11 - 22
 * Time: 22:09
 */
//牛客 收件人列表
public class Solution22 {
    public static void main1(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextInt()) { // 注意 while 处理多个 case
            int n = in.nextInt();
            in.nextLine();
            String[] arr = new String[n];
            for (int i = 0; i < n; i++) {
                arr[i] = in.nextLine();
            }
            StringBuilder stringBuilder = new StringBuilder();
            for (int i = 0; i < n; i++) {
                if (f(arr[i])) {
                    stringBuilder.append('"');
                    stringBuilder.append(arr[i]);
                    stringBuilder.append('"');
                } else {
                    stringBuilder.append(arr[i]);
                }
                if (i != (n - 1)) {
                    stringBuilder.append(',');
                    stringBuilder.append(' ');
                }
            }
            System.out.println(stringBuilder);
        }
    }
    private static boolean f(String str) {
        for (int i = 0; i < str.length(); i++) {
            if (str.charAt(i) == ',' || str.charAt(i) == ' ') {
                return true;
            }
        }
        return false;
    }
}
